using System;
using System.Collections.Generic;
using DotNetNuke.Common.Utilities;

namespace Code5Systems.FormMaster.Business
{

	public class GlobalController
	{
		
#region Global Methods
		
		public GlobalInfo GetGlobal(int globalID)
		{
			return ((GlobalInfo) (CBO.FillObject(Code5Systems.FormMaster.Data.DataProvider.Instance().GetGlobal(globalID), typeof(GlobalInfo))));
		}
		
		public GlobalInfo GetGlobalByKey(string itemKey)
		{
			return ((GlobalInfo) (CBO.FillObject(Code5Systems.FormMaster.Data.DataProvider.Instance().GetGlobalByKey(itemKey), typeof(GlobalInfo))));
		}
		
		public List<GlobalInfo> ListGlobals()
		{
			return CBO.FillCollection<GlobalInfo>(Code5Systems.FormMaster.Data.DataProvider.Instance().ListGlobals());
		}
		
		public int AddGlobal(GlobalInfo objC5SLLC_Global)
		{
			return Code5Systems.FormMaster.Data.DataProvider.Instance().AddGlobal(objC5SLLC_Global.ItemKey, objC5SLLC_Global.ItemValue);
		}
		
		public void UpdateGlobal(GlobalInfo objC5SLLC_Global)
		{
			Code5Systems.FormMaster.Data.DataProvider.Instance().UpdateGlobal(objC5SLLC_Global.GlobalID, objC5SLLC_Global.ItemKey, objC5SLLC_Global.ItemValue);
		}
		
		public void DeleteGlobal(GlobalInfo objC5SLLC_Global)
		{
			Code5Systems.FormMaster.Data.DataProvider.Instance().DeleteGlobal(objC5SLLC_Global.GlobalID);
		}
#endregion
		
		private static object GetNull(object Field)
		{
			return Null.GetNull(Field, DBNull.Value);
		}
		
#region FormMaster Purge Method
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Purges all FormMaster data from the database
		/// </summary>
		/// <remarks>
		/// </remarks>
		/// <history>
		/// Generated by CodeSmith on Friday, May 25, 2012
		/// </history>
		/// -----------------------------------------------------------------------------
		//<DataObjectMethod(DataObjectMethodType.Delete)> _
		//Public Sub FormMasterPurge(ByVal portalId As Integer)
		//	DataProvider.Instance().PurgeFormMaster(portalId)
		//End Sub
#endregion
		
		
	}
}

